﻿using System;
using System.Collections.Generic;
using System.Linq;
using Tools;
using Web.Models.CoreData;


namespace Web.ViewModel.CoreData
{
    public class ReportModel
    {
        /// <summary>
        /// 船舶mmsi
        /// </summary>
        public String MMSI { get; set; }
        /// <summary>
        /// 时间戳
        /// </summary>
        public long TimeStamp { get; set; }
        /// <summary>
        /// 报告时间
        /// </summary>
        public String ReportTime { get; set; } 

        /// <summary>
        /// 报文类型
        /// </summary>
        public String Type { get; set; }
        /// <summary>
        /// hash组合值
        /// </summary>
        public String valueHash { get; set; }
        /// <summary>
        /// 船名
        /// </summary>
        public String ShipName { get; set; }

        /// <summary>
        /// 报文值
        /// </summary>
        public String Value { get; set; }
        /// <summary>
        /// 模型转换
        /// </summary>
        /// <param name="model"></param>
        /// <param name="users"></param>
        /// <returns></returns>
        public static ReportModel ConvertMondel(Report model,List<User> users=null )
        {
            return new ReportModel()
            {
                MMSI = model.MMSI,
                ReportTime = DateTimeHelper.GetDateTime(model.ReportTime).ToString("yyyy-MM-dd HH:mm:ss"),
                ShipName = model.ShipName,
                Type = model.Type,
                Value = model.Value,
                TimeStamp = model.ReportTime
            };
        }
    }
    /// <summary>
    /// 报文详细模型
    /// </summary>
    public class ReportDetailModel
    {
        /// <summary>
        /// 报告时间
        /// </summary>
        public DateTime ReportTime { get; set; }
        /// <summary>
        /// 船舶信息
        /// </summary>
        public Ships ShipInfo { get; set; }
        /// <summary>
        /// 报文基本信息
        /// </summary>
        public DataUin DataUin { get; set; }
    }


    /// <summary>
    /// 船舶信息
    /// </summary>
    public class Ships
    {
        /// <summary>
        /// MMSI信息
        /// </summary>
        public string MMSI { get; set; }
        /// <summary>
        /// 船名
        /// </summary>
        public string ShipName { get; set; }
        /// <summary>
        /// 船名简称
        /// </summary>
        public string ShipShortName { get; set; }
        /// <summary>
        /// 螺旋桨螺距
        /// </summary>
        public double Pitch { get; set; }
    }

   
    /// <summary>
    /// 报文统计模型
    /// </summary>
    public class ReportCountModel
    {
        /// <summary>
        /// 船舶mmsi信息
        /// </summary>
        public string MMSI { get; set; }
        /// <summary>
        /// 船舶名称
        /// </summary>
        public string ShipName { get; set; }
        /// <summary>
        /// 报文列表
        /// </summary>
        public List<ReportModel> ReportList { get; set; }
    }

    
    /// <summary>
    /// 报文基本信息
    /// </summary>
    public class DataUin
    {
        /// <summary>
        /// 数据标识
        /// </summary>
        public Guid Id { get; set; }
        /// <summary>
        /// 报文类型
        /// </summary>
        public string Type { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        public DateTime CreateTime { get; set; }
        /// <summary>
        /// 发送时间
        /// </summary>
        public DateTime SendTime { get; set; }
    }

}
